Creating Leaves Using 3D Particles
This tutorial shows how to simulate tree or plant leaves using textured 3D particles .
Beginner/intermediate level.
Creating the particles
Click on the Creation tab and select
the Particle tool.

Particle tool selected, set to create 3D particles using the airbrush
pen.
Select the 3D particles and select the Airbrush pen. This allows
you to literally spray particles around. Next set the Brush radius to 30,
Count to 2 and Project to 'Sphere'.
These settings allow you to spray just a few 3D particles with every
mouse click. This also causes the particles to be sprayed around using a
spherical brush, meaning that the particles are not all in the same 2D
plane, but spread in all 3 dimensions, only limited by the size of the
brush.

Spherical brush projection selected
To see how this spherical brush works, just
click and hold the right mouse button for about 10 seconds and then accept
the tool. In your view window the particles will form a 3D sphere about the size of your brush.
Press Ctrl + Z to undo last action. Then, in the view window, press the right
mouse button and select 'Again' from the pop-up menu. This restarts the
particle tool with the same settings as you had the last time you used it.

Select 'Again' to restart the tool with the same settings as last time
The particle tool has some additional controls for size and direction. Set 'Size'
to 0.1, 'RndSize' (Random Size) to zero and RndDir (Random Direction) to
0.5. If RndSize is set to zero, all particles will have the same size.
If RndSize is set to a higher value, more and more particles will have a
different size.
The same goes for RndDir: if set to zero, all particles will have the same
orientation towards the camera; change that value and their orientation will change
randomly.

Settings for Size, Random Size and Random Direction
All settings
are OK now. So, spray just a few particles around by clicking and releasing
the left mouse button at various locations in the view window. If you click
and hold the left mouse button, more particles are added to the scene. When
done, accept the tool. A 3D particle object is now added to the hierarchy in
the Select Window.

From
spheres to rectangles
If we now render the scene, all 3D particles will
render as spheres. This is the default setting. Because we want to make the
particles look like leaves, we need the shape to change from spheres into rectangles.
This is simply done by changing the properties of the 3D particle object.
Double click on the 3D particle object in the Select Window to open it's
properties. Go to the Spec tab of the property window. On the Rendering tab
make sure that "Post Processing" and "Scan Line" are unchecked and then
check "Ray Tracing" and then "Ray Trace Rectangles". This last option
ensures that all particles are rendered as rectangles, which can be
textured. In our case, we can texture them now to look like leaves. And
because we set the RndDir option as well, not all rectangles (leaves) will
face the camera, which enhances the effect we need.

Ray Tracing and Ray Trace Rectangles options set on the Rendering tab of
the property window
When the Ray Trace Rectangles option is set, all 3D particles are rendered as
equally sized squares. This is of course due to the settings we used when
creating them (RndSize = 0). It is also possible to edit the size and shape of
each individual particle inside the 3D particle object after we created them. Attributes like size, shape,
position and orientation of the individual particles can even be keyframed for
animation.
To change the size of a single particle, just select the particle object in
the Select Window and press the Space bar
on your keyboard to go in edit mode. The 3D particles have 3 points that can
be edited and one center point that can be used to move the particle around:

A single 3D particle in edit mode
Modifying a the shape of a particle is simple: just drag the red dots on each axis
until the particle reaches desired shape. To move a particle, just drag the red dot in the center of the
particle to a new location in your view window. If you wish to move several individual particles, hold the Shift key and click at the
center dot of each particle you wish to move. You can also use the Drag
Select method to multi select particles.
To modify all selected particles simultaneously, use the Drag
Select method to multi select particles and then apply the Noise tool, which
is located in the Transformation toolbar .
Creating the Leaf material
Create a new VSL material, call it Leaf1. Check the Preview box. We need a
leaf texture and an alpha map of the same leaf. So why not use these two
images?


The color map (D_longleaf.gif) and the alpha map (A_longleaf.gif) of our leaves
(Thanks Bernie den Hertog!)
Just save these two images to your favorite directory and use them in this
tutorial.
Use the texture wizard and
select the colored leaf texture (D_Longleaf.gif). Leave the Tile X,Y and Grade X,Y boxes
empty. Check the Advanced checkbox to get access to the VSL
statements.
Select a Constant object and drag that into the Surface
properties shader. In the lower section of the property window there are
three tabs, related to the Constant object. We start with the third
(most right hand) tab. The third tab is called the In/Out tab. Make sure
that 'Output' is set to 'Surface : Fade'. Notice that the preview box turns
empty!

The Constant object added, output set to fade and constant value set to
1.
The second tab is called General. The Operation should be set to '='
(the default value) and do not check the other boxes.
Finally, go to the first tab (Constant) and set the Constant value to 1.
Select the Color=Texture(Map coords)
instruction, press the right mouse button and select 'Duplicate' from the
pop-up menu.
The duplicate instruction will be placed at the bottom of the hierarchy.

The Color=Texture(MapCoords) instruction will be duplicated
Select the duplicate instruction. In the lower section of the property
window there are now five tabs. Go to the Texture tab and select the alpha
map image (A_longleaf.gif). Next, click the General tab. Set Operation to
' - ' (the minus sign) .Finally, go to the In/Out tab. Click on 'Output'
and next set the Output to 'Surface : Fade', simply by selecting it from the
list on the right side of the window.

Finally, drop a VSL curve object into the hierarchy, which gives us color
control over the texture. At the In/Out tab of the curve object, set both
'Input 0' and 'Output' to 'Surface : Color'. The shader should now
look like this:

The material is completed.
And then...
Map the Leaf1 texture to the 3D particles using a default mapping.
Add a simple infinite rectangle to have a background and add a light source. Press render, and you should get something like this...

The first render: leaves-textured particles!
Now this scene can be made more interesting, if not all leaves have the same
color. This is where the VSL curve object becomes handy. Perform the
following steps:
1 Create just a few new particles using similar settings
as before and now also add some random
size, like 0.3.
2. Duplicate the Leaf1 material, call it Leaf2
3. Modify the color of the texture in Leaf2, using the VSL curve. This is
done as follows. Make sure the material Preview box is checked. In the VSL
property window, select the Color=Curve(Color) instruction. In the lower
section of the window a graph appears, showing a red line. Click in the
middle of the red line. This creates a knot point. Drag the knot point
slightly diagonally upwards. Notice the color change in the preview box.
When happy with the new color, close the property window.
4. Render again and it already looks more interesting!
Another example
In this part of the tutorial we put our knowledge to use and show some more
of the shear power of 3D particles!
First create an analytic cube, which will act as a brick wall. Then create a
brick texture and map that to the cube (wall) using a parallel
projection. Don't forget to enable the Roll option in the parallel mapping
object. You get something like this:

Nice brick wall eh?
Then it's time to grow some plants on that wall. Again we will use our 3D
particles with the same Leaf1 material applied to it. Only this time we
will use a different projection when creating the particles. This allows us
to let the plants follow the structure of the wall. Activate the particle
tool again, select 3D particles and the airbrush pen, just like before, only
this time with the following settings:

Settings for the 3D particles. Notice the Surface projection and the size
of the particles.
Make sure the cube (wall) is selected in the Select window. Now spray just a
few particles at a time right on the top left corner of the wall and make
your way down. Notice that there will be no particles added to the scene when you do not
spray on the wall. This is because we set the projection method to 'Surface' and we selected the wall as target.
Then open the properties of the 3D particle object, set the Ray Tracing and
Ray Trace Rectangle options at the Spec tab. Apply a default mapping
of the Leaf1 material. Then repeat the particle creation process with the same settings and
then apply the Leaf2 material and render. I got something like this:

Wall with some leaves growing over it.
When using many textured particles, you may find yourself waiting for your
render to finish. Setting the 'No Shadows' option in the property window of
the 3D particle object could be a real time saver!

No Shadows option set, to increase render speed!